<%@ page contentType="text/html; charset=UTF-8" language="java" %>
<%@ include file="/parameter.jsp" %>
<%@page isELIgnored="false"%>
<!DOCTYPE>
<html>
<head>
<TITLE>论坛</TITLE>
<%@ include file="/pageParam.jsp" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<Meta http-equiv="Pragma" Content="No-cach">
<link href="style/style.css" rel="stylesheet" type="text/css" />
<script language="javascript">
     window.onload = function(){
      var oFCKeditor = new FCKeditor('fckcontent') ;
      oFCKeditor.BasePath = '${pageContext.request.contextPath}/FCKeditor/' ;
      oFCKeditor.ToolbarSet = 'Basic' ;
      oFCKeditor.Width = '100%' ;
      oFCKeditor.Height = '300' ;
      oFCKeditor.ReplaceTextarea();
	 }
	 
function submitit(){
	if(form1.paramboard.value == "topic"){
		if(form1.title.value == ""){
			alert("标题不能为空！请填写标题！");
			form1.title.focus();
			return false;
		}
	}
	/*
	if(form1.content.value == ""){
		var fck = FCKeditorAPI.GetInstance("fckcontent"); 
        var content = fck.GetXHTML(true);
        if (content.replace('/<(?!img|input|object)[^>]*>|/s+/ig', "") == "") {
    		alert("内容不能为空！请填写内容！");
            fck.Focus();
            return false;
        }
	}
	*/
	return form1.submit();
}

function loginsubmit(){
	return form2.submit();
}

var fileIndex = 1;
function addImage()
{
	var pho = '<input type="file" name="attfile'+fileIndex+'" />';
	$('#pho').append('<br />');
	$('#pho').append(pho);
	fileIndex++;
}
function SearchSubmit(){
	if(doucment.getElementById('keywords').value == ""){
		alert("请输入搜索关键字！");
		return false;
	}else{
		return document.forms["form3"].submit();
	}
}
</script>
</HEAD>
<body>
<jsp:include page="inc/header.jsp"/>
		<header class="entry-header">
			<h1 class="entry-title">
				<span>论坛首页<div id="searchbar">
				<form name="form3" method="post" action="commonAction.do?method=SearchTopic">
					<input type="text" id="keywords" name="keywords" title="搜索"><button onClick="search();">搜索</button>
				</form>
				</div></span>
			</h1>
		</header>
		
		<div id="maindiv">
			<div id="nav">
			<c:choose>
				<c:when test="${sessionScope.user == null}">
					<div>
						<form name="form1" method="post" action="commonAction.do?method=UserLogin">
						账号：<input type="text" name="username"> 密码：<input type="password" name="password"> 
						<button onClick="loginsubmit();">登陆</button> <a href="commonAction.do?method=toRegister">注册新账号</a>
						</form>
					</div>
				</c:when>
				<c:otherwise>
					<div>
					&nbsp;&nbsp;<c:choose><c:when test="${sessionScope.user.nickname != ''}">${sessionScope.user.nickname}</c:when><c:otherwise>${sessionScope.user.username}</c:otherwise></c:choose>&nbsp;你好！<a
							href="commonAction.do?method=Logout">注销</a>&nbsp;|&nbsp;<a
							href="commonAction.do?method=EditUserInfo&uid=${sessionScope.user.id}">修改个人信息</a>&nbsp;|&nbsp;<a
							href="commonAction.do?method=EditUserPwd&uid=${sessionScope.user.id}">修改密码</a>
					</div>
				</c:otherwise>
			</c:choose>
				<a href="./" title="首页">首页</a>
				<span>&gt;</span>
				<a href="commonAction.do?method=SortTopicInfo&superid=${board.supersetid}&sortid=${board.id}&param=1">${board.boardname}</a>
			</div>
			
			<div id="board">
				<div class="bm">
					<div id="post_r">
						<div class="bm_h"><h2>发布新帖</h2></div>
						<div class="replay_b">
							<form name="form1" method="post" action="commonAction.do?method=TopicResponsSubmit&param=${paramboard}&id=${board.id}&tid=${tid.id}&pid=${pid.id}&paramsort=${paramsort}&lag=0" enctype="multipart/form-data">
								<c:if test="${paramboard != 'respons'}">
								<!--<div class="msg">
									<span class="message cl">&#8226;&nbsp;提示消息样式</span>
									<span class="error cl">&#8226;&nbsp;错误消息样式<span>
								</div>-->
								<div class="frm_row">
									<label>关键字: </label>
									<select onChange="" name="postkey">
										<option selected="" value="">请选择...</option>
										<c:forEach items="${typeInfo}" var="typeInfo">
										<option value="${typeInfo}">${typeInfo}</option>
										</c:forEach>
									</select>
								</div>
								<div class="frm_row">
									<label>标　题: </label><input type="text" title="请填写标题！" value="" maxlength="100" size="93" name="title" />
								</div>
								</c:if>
								<div class="frm_row">
									<textarea id="fckcontent" name="content" style="display:none"></textarea>
								</div>
								<div class="frm_row">
									<div class="cl"><label>附　件: </label></div>
									<div id="pho"><input type="button" onClick="addImage()" value="添加附件"><br /><input type="hidden" name="paramboard" value="${paramboard}"/></div>
								</div>
							</form>
								<div class="frm_row">
									<button onClick="submitit();">发布</button>
								</div>

						</div>
					</div>
				</div>
			</div>
	
		</div>

<jsp:include page="inc/footer.jsp"/>
</body>
</HTML>